namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;
    using Entities;
    using Column;

    using SharePoint.Wss.Columns;
    using SharePoint.Wss.Lists;

    [TestClass]
    public class CreateLookupColumnTest
    {

        /// <summary>
        /// This test was originally generated but has now been tested and verfiied by MJ
        /// </summary
        [TestMethod]
        public void CreateLookupColumn_Test()
        {
            WSSTestAssistant<CreateLookupColumn, CreateLookupColumnInfo> createlookupcolumn =
                    new WSSTestAssistant<CreateLookupColumn, CreateLookupColumnInfo>(TestEnvironment.PublishingSite, "CreateLookupColumnTestWeb", "BLANKINTERNET#0");

            using (createlookupcolumn)
            {
                MacroReport doReport = createlookupcolumn.DoMacro();

                SPFieldLookup lookup = (SPFieldLookup)SiteColumnHelper.GetField(createlookupcolumn.TestWeb, createlookupcolumn.FirstEntity.FieldName);

                Assert.IsNotNull(lookup);
                Assert.IsTrue(lookup.AllowMultipleValues == createlookupcolumn.FirstEntity.AllowMultipleValues);
                Assert.IsTrue(lookup.Group == createlookupcolumn.FirstEntity.Group);
                Assert.IsTrue(lookup.Required == createlookupcolumn.FirstEntity.Required);

                SPList list = SPListHelper.GetList(createlookupcolumn.FirstEntity.LookupListUrl);
                Assert.IsTrue(lookup.LookupList.ToUpper() == list.ID.ToString("B").ToUpper());
                Assert.IsTrue(lookup.LookupField == createlookupcolumn.FirstEntity.LookupFieldName);



            }
        }

    }
}
